package ForTest;
/*
使用for循环，实现1-100所有奇数求和
两种方案写出
 */
public class ForTest2 {
    public static void main(String[] args){
        int sum = 0;
        int sum1 = 0;
        for(int i = 1; i <= 100; i++){
            if(i % 2 != 0){
                System.out.println(i);
                sum += i;
            }
        }
        System.out.println(sum);
        for(int j = 1; j <= 100; j += 2){
            System.out.println(j);
            sum1 += j;
        }
        System.out.println(sum1);
    }
}
